import { createRouter, createWebHistory } from 'vue-router'
import { constRoutes } from "@/router/routes";

const router = createRouter({
    history: createWebHistory(),
    routes: constRoutes,
    scrollBehavior() {
        return { top: 0, left: 0}
    },
})

// 设置每个页面不同的标题
router.afterEach((to, from, next) =>{
    if(to.meta.title){
        document.title = to.meta.title as string
    }
})

export default router
